package com.hb.core.pojo.center.au.dto;

import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.fzzn.core.model.enums.MsgEnum;

import java.io.Serializable;

/**
 * 账号密码登录
 *
 * @author ljs
 */
@Setter
@Getter
@ApiModel(value = "UserLoginDTO", description = "用户名密码登录DTO")
public class UserLoginDTO implements Serializable {
    @ApiModelProperty(value = "用户名", required = true)
    private String username;
    @ApiModelProperty(value = "密码", required = true)
    private String password;
    @ApiModelProperty(value = "角色标志位 1：招标人，2：投标人，3：代理机构", required = true)
    private Integer roleSign;

    /**
     * 登录的参数验证
     *
     * @return
     * @author zhaojk
     */
    public String paramsValid() {
        if (StrUtil.isEmpty(username)) {
            return MsgEnum.USERNAME_NOT_ALLOW_EMPTY.msg();
        }
        if (StrUtil.isEmpty(password)) {
            return MsgEnum.PASSWORD_NOT_ALLOW_EMPTY.msg();
        }
        return null;
    }
}
